﻿#include "personbuilder.h"

PersonBuilder::PersonBuilder(QPainter* pt, int a, int b) :
    painter(pt), w(a), h(b){}

//瘦人的实现
void PersonThinBuilder::buildHead()
{
    QRect rect(w/4, h/12, w/2, h/6);
    painter->drawEllipse(rect);
}

void PersonThinBuilder::buildBody()
{
    QRect rect(w/4, h/4, w/2, 7*h/12);
    painter->drawRect(rect);
}

void PersonThinBuilder::buildArmLeft()
{
    QLine line(w/4, h/3, w/8, h/2);
    painter->drawLine(line);
}

void PersonThinBuilder::buildArmRight()
{
    QLine line(3*w/4, h/3, 7*w/8, h/2);
    painter->drawLine(line);
}

void PersonThinBuilder::buildLegLeft()
{
    QLine line(3*w/8, 5*h/6, w/4,11*h/12);
    painter->drawLine(line);
}

void PersonThinBuilder::buildLegRight()
{
    QLine line(5*w/8, 5*h/6, 3*w/4,11*h/12);
    painter->drawLine(line);
}
